import java.util.Scanner;
public class test10{
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter r1's center x-, y-coordinates, width, and height: ");
        double r1X = input.nextDouble();
        double r1Y = input.nextDouble();
        double r1W = input.nextDouble();
        double r1H = input.nextDouble();
        System.out.print("Enter r2's center x-, y-coordinates, width, and height: ");
        double r2X = input.nextDouble();
        double r2Y = input.nextDouble();
        double r2W = input.nextDouble();
        double r2H = input.nextDouble();
        double r1Left = r1X - r1W / 2;
        double r1Right = r1X + r1W / 2;
        double r1Bottom = r1Y - r1H / 2;
        double r1Top = r1Y + r1H / 2;
        double r2Left = r2X - r2W / 2;
        double r2Right = r2X + r2W / 2;
        double r2Bottom = r2Y - r2H / 2;
        double r2Top = r2Y + r2H / 2;
        boolean isInside = (r2Left >= r1Left) && (r2Right <= r1Right) 
                        && (r2Bottom >= r1Bottom) && (r2Top <= r1Top);
        boolean isOverlap = !isInside && (r2Left < r1Right) && (r2Right > r1Left) 
                         && (r2Bottom < r1Top) && (r2Top > r1Bottom);
        if (isInside) {
            System.out.println("r2 is inside r1");
        } else if (isOverlap) {
            System.out.println("r2 overlaps r1");
        } else {
            System.out.println("r2 does not overlap r1");
        }
        input.close();
    }
}
